#include<iostream>
using namespace std;
#include<vector>
class Solution {
public:
    void showPole(const vector<int>& p) {
        for(auto it=p.begin(); it!=p.end(); it++) {
            cout << *it << " ";
        }
        cout << endl;
    }
    void move(vector<int>& from,vector<int>& to) {
        cout << "move:" << endl;
        showPole(from);
        showPole(to);
        cout << "->" << endl;
        to.push_back(from.back());
        from.pop_back();
        showPole(from);
        showPole(to);
        cout << endl;
    }
    void hanoi(int n,vector<int>& A, vector<int>& B, vector<int>& C) {
        if(n == 1) {
            move(A,C);
        } else {
            hanoi(n-1,A,C,B);
            move(A,C);
            hanoi(n-1,B,A,C);
        }
    }
    void hanota(vector<int>& A, vector<int>& B, vector<int>& C) {
        this->hanoi(A.size(),A,B,C);
    } 
    void hmove(char from,char to) {
        cout << from << " -> " << to << endl;
    }
    void hanoi(int n,char A = 'A',char B = 'B',char C = 'C') {
        if(n == 1) {
            hmove(A,C);
        } else {
            hanoi(n-1,A,C,B);
            hmove(A,C);
            hanoi(n-1,B,A,C);
        }
    }
};

int main() {
    Solution().hanoi(3);
    return 0;
}